package com.Jhu1.util;

import org.mindrot.jbcrypt.BCrypt;

public class SecurityUtil {
    
    // 生成加密后的密码
    public static String getSecurityPassword(String password) {
        String salt = BCrypt.gensalt();
        return BCrypt.hashpw(password, salt);
    }
    
    // 校验原始密码与加密后的密码是否匹配
    public static boolean verifyPassword(String rawPassword, String hashedPassword) {
        return BCrypt.checkpw(rawPassword, hashedPassword);
    }
}
